package com.example.demo.annotation;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 *
 * @author kaka
 */
@Slf4j
@Aspect
@Component
public class TestAnnotationAspect {


    @Around(value = "@annotation(testAnnotation)")
    public Object around(ProceedingJoinPoint pjp, TestAnnotation testAnnotation) throws Throwable {
        log.info("执行TestAnnotation注解Around before advice:{}", pjp.getSignature());
        log.info("testAnnotation中的参数:{}", testAnnotation.value());
        Object result = pjp.proceed();
        log.info("执行TestAnnotation注解Around after advice:{}", pjp.getSignature());
        return result;
    }

}
